set(CMAKE_MODULE_PATH
    ${CMAKE_MODULE_PATH}
    ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules) 
    
find_package(PolkitQt REQUIRED)

find_package(KDE4 REQUIRED)

include(KDE4Defaults)

add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})

include_directories(${CMAKE_SOURCE_DIR}
                    ${CMAKE_BINARY_DIR}
                    ${KDE4_INCLUDES})

qt4_add_dbus_adaptor(netcfgadaptor_SRCS
                     org.archlinux.netcfg.xml
                     netcfghelper.h
                     NetcfgHelper)

set(netcfghelper_SRCS
    netcfghelper.cpp)

kde4_add_executable(netcfg_helper
                    ${netcfghelper_SRCS}
                    ${netcfgadaptor_SRCS})

target_link_libraries(netcfg_helper
                      ${QT_QTCORE_LIBRARY}
                      ${QT_QTDBUS_LIBRARY}
                      ${KDE4_KDECORE_LIBS}
                      ${POLKITQT_LIBRARIES})

dbus_add_activation_system_service(org.archlinux.netcfg.service.in)

install(TARGETS netcfg_helper
        DESTINATION ${LIBEXEC_INSTALL_DIR})

install(FILES org.archlinux.netcfg.conf
        DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d)

install(FILES org.archlinux.netcfg.policy
        DESTINATION ${POLICY_FILES_INSTALL_DIR})

install(FILES org.archlinux.netcfg.xml
        DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
